package com.jd.fruit.model.admin.auth;

import com.jd.fruit.common.annotation.Table;
import com.jd.fruit.common.model.BaseModel;
import com.jd.fruit.common.util.StringUtil;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

/**
 * 角色
 * 
 */
@SuppressWarnings("serial")
@Table("t_admin_role")
public class AdminUserRole extends BaseModel<AdminUserRole> { 
	public static final AdminUserRole dao = new AdminUserRole();
	
	
	/**
	 * 保存管理员角色
	 * @param adminRole
	 */
	public void save(AdminUserRole adminUserRole){
		try {
			adminUserRole.set("id",StringUtil.getKey());
			adminUserRole.save();
		} catch (Exception e) {
			throw new RuntimeException("管理员角色保存异常！", e);
		}
	}
	
	/**
	 * 删除与角色相关联菜单的数据
	 * @param roleid
	 */
	public void delAdminRelationRole(String columnName,String adminid) {
		Db.deleteById("t_admin_role",columnName, adminid);
	}


	@Override
	public void initWhere() {
		// TODO Auto-generated method stub
		
	}
	
	
}
